﻿using System;

namespace Validity
{
  public struct RuleViolation
  {
    private readonly String _message;

    public String Message { get { return _message; } }

    public RuleViolation(String message)
    {
      Verify.False(String.IsNullOrEmpty(message));

      _message = message;
    }

    public static explicit operator RuleViolation(String message)
    {
      return new RuleViolation(message);
    }

    public static implicit operator String(RuleViolation ruleViolation)
    {
      return ruleViolation.Message;
    }

    public override string ToString()
    {
      return Message;
    }
  }
}
